//require()首先在node运行时寻找包，接着去node_modules找。

const mongoose = require('mongoose');

// mongoose.connect('mongodb://localhost/qf2107', {
//   useNewUrlParser: true,
//   useUnifiedTopology: true,
//   useFindAndModify: false,
//   useCreateIndex: true
// });

mongoose.connect('mongodb://localhost/qf2107');

const conn = mongoose.connection
conn.on('open', ()=>console.log('数据库连接成功'))
conn.on('error', ()=>console.log('数据库连接失败'))
